<?php
/**
 * Created by PhpStorm.
 * User: 1
 * Date: 2018/3/23
 * Time: 11:24
 */

namespace app\api\controller\v1;

use app\common\lib\exception\ApiException;
use think\Db;
use app\api\model\Address as M;

class Address extends Common
{
    /**
     * @获取省
     * @author 巫玉梅 <1120504614@qq.com>
     * @return ApiException|array|string|\think\response\Json
     */
    public function get_province(){
        $m = new M();
        return $m->province();
    }
    /**
     * @获取市
     * @author 巫玉梅 <1120504614@qq.com>
     * @return ApiException|array|string|\think\response\Json
     */
    public function get_city(){
        return (new M())->city();
    }
    /**
     * @获取地区
     * @author 巫玉梅 <1120504614@qq.com>
     * @return ApiException|array|string|\think\response\Json
     */
    public function get_area(){
        $area = (new M())->area();
        return $area;
    }

    /**
     * 地址编码以及地址
     * @param area_code string 区域编码 *必传
     * @author 王柯 <wangke.email@foxmail.com>
     * @return array|string|\think\response\Json
     */
    public function get_address_code(){
        $result = (new M())->addressCode();
        return $result;
    }

    /**
     * 获取用户地址详情
     * @param id int 用户id 必传
     * @author 吴铸峰 <1120504614@qq.com>
     * @return \think\response\Json
     */
    public function get_address_details(){
        $result = (new M())->addressDetail();
        return $result;
    }

    /**
     * 修改会员地址
     * @param area_code string 区域编码 *必传
     * @author 王柯 <wangke.email@foxmail.com>
     * @return array|string|\think\response\Json
     */
    public function edit_address(){
        $result = (new M())->editMemberAddress();
        return $result;
    }

}